import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.*;


public class ContainerResumeExt implements Externalizable {
	
	protected List<ResumeExt> resumes;
	
	public ContainerResumeExt(){
		resumes = new LinkedList<ResumeExt>();
	}
	
	public void addItem(ResumeExt resumeExt){
		resumes.add(resumeExt);
	}
	
	public void writeExternal(ObjectOutput out) throws IOException {
        out.writeInt(resumes.size());
        for(Externalizable ext : resumes)
            ext.writeExternal(out);
    }

    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
        int count = in.readInt();
        for(int i=0; i<count; i++){
        	ResumeExt ext = new ResumeExt();
            ext.readExternal(in);
            resumes.add(ext);
        }
    }
    
    public ResumeExt get(int number){
    	return resumes.get(number);
    }
    
    public String toString() {
        return getClass().getName()+" ("+resumes.size()+" resumes)";
    }
    
}
